#!/bin/bash

set -e

cd `dirname $0`/..

script/set-version $1
echo "release web-ext-host version" $1


cd localnative-rs/localnative_cli
cargo build --release

cd ../..

if [[ "$OSTYPE" == "linux-gnu" ]]; then
  POSTFIX="-gnu-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
  POSTFIX="-mac"
elif [[ "$OSTYPE" == "cygwin" ]]; then
  POSTFIX=".exe"
fi

DIR=localnative-neon/lib
FILE="localnative-web-ext-host-$1$POSTFIX"
rm -f $DIR/localnative-web-ext-host*
cp localnative-rs/target/release/localnative-web-ext-host $DIR/$FILE
